<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>新订单</title>
</head>

<div th:include="html/common/IncludeTop :: IncludeTop"></div>
<div id="BackLink">
    <a th:href="@{main}">Return to Main Menu</a>
</div>
<div class="public-shop-cart-two">
    <div class="content">
        <span>全部商品</span>

        <div class="cart-title">
            <span>商品</span>
            <span>商品ID</span>
            <span>所属小类ID</span>
            <span>商品信息</span>
            <span>单价</span>
            <span>数量</span>
            <span>小计</span>
            <span>操作</span>
        </div>
        <%--            如果购物车是空的--%>
        <th:if test="${sessionScope.cart.numberOfItems == 0}">
            <div class="cart-detail">
                <div class="cart-price">你的购物车是空的，快去挑选商品吧！！！！！</div>
            </div>


        </th:if>


        <

                  tr th:each="order: ${session.orderList}">
            <div th:each="cartItem:${session.cart.cartItems}" class="cart-detail">

                <div class="cart-title" th:text="${cartItem.item.attribute5}">

                </div>
        <%--ItemId--%>
                <div class="cart-price"><a th:href="@{viewItem?itemId=${cartItem.item.itemId}}" th:text="${cartItem.item.itemId}"></a></div>

        <%--ProductId--%>
                <div class="cart-price" th:text="${cartItem.item.product.productId}"></div>
        <%--商品描述信息--%>
                <div class="cart-price" th:text=" ${cartItem.item.attribute1} ${cartItem.item.attribute2}${cartItem.item.attribute3} ${cartItem.item.attribute4}">

                </div>
        <%--单价--%>
                <div class="cart-price" th:text="${#numbers.formatCurrency(${cartItem.item.listPrice})}"></div>
        <%--数量--%>
                <div class="cart-number" >
                    <input type="text" th:id="${cartItem.item.itemId}" class="cartQuantity" th:name="${cartItem.item.itemId}" th:text="${cartItem.quantity}">
                    <div id="cartMsg"></div>
                </div>
        <%--总价--%>
                <div class="cart-subtotal" th:id="${cartItem.item.itemId}total" th:text="${#numbers.formatCurrency(${cartItem.item.total})}"></div>
        <%--删除--%>
                <div class="cart-oprate"><a th:href="@{removeItemFromCart?workingItemId=${cartItem.item.itemId}}" >删除</a></div>
            </div>
        </th:each>

        <th:if test="${sessionScope.cart.numberOfItems > 0}">
            <div class="cart-btn" ><span>总价：</span><span id="subtotal"> ¥${sessionScope.cart.subTotal} </span><button class="btn"><a  href="newOrderForm?itemId=${cartItem.item.itemId}">去结算</a></button></div>
        </th:if>

    </div>
</div>

<%@ include file="../common/IncludeBottom.jsp"%>
